<template>
	<view style=" padding: 30rpx;">
		<button @click="onSetTimeout()" type="primary">单次计时器</button>
		<button @click="onSetTimeoutXY('hsr',999)" type="primary" plain="true">启动传参计时器</button>
		<button @click="onClearTimeout()" type="warn">取消计时器</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				timer1:null,
				
			}
		},
		methods: {
			onSetTimeout(){
				console.log("onSetTimeOut()");
				this.timer1 = setTimeout(()=>{
					console . log("onSetTimeOut() callback");
					// .....
					console . log("onSetTimeOut() callback end");
				},3000);
			},
			onSetTimeoutXY(username,pwd){
				console.log("onSetTimeOut()",username,pwd);
				setTimeout((x,y)=>{
					console.log("-----callback",x,y);
				},2000,username,pwd)
			},
			onClearTimeout(){
				clearTimeout(this.timer1)
			}
		}
	}
</script>

<style>
button{
	margin: 30rpx;
}
</style>
